package com.example.hasee.zhcd.Activities.ChuanWu;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;


;import com.example.hasee.zhcd.R;
import com.example.hasee.zhcd.Util.GlobalParameter;
import com.example.hasee.zhcd.View.ZoomImageView;


/**
 * Created by hasee on 2017/10/16.
 */

public class PictrueActivity extends Activity implements View.OnClickListener {
    private TextView title;
    private ImageView back;
    private ImageView home;
    private Bitmap bitmap;
    private String net;
    private ZoomImageView centerView;
    private byte[] bytepic;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pictrue);
        findView();
        title.setText("查看图片");
        back.setOnClickListener(this);
        home.setVisibility(View.INVISIBLE);
        String picString = getIntent().getExtras().getString("string");
        bitmap = ArrivalsDetailActivity.base64ToBitmap(picString);


//        bytepic=getIntent().getByteArrayExtra("bitmap");
//        bitmap=Bytes2Bimap(bytepic);
        centerView.setImageBitmap(bitmap);

    }

    public Bitmap Bytes2Bimap(byte[] b) {
        if (b.length != 0) {
            return BitmapFactory.decodeByteArray(b, 0, b.length);
        } else {
            return null;
        }
    }

    private void findView() {
        title = (TextView) findViewById(R.id.centertitle);
        back = (ImageView) findViewById(R.id.back);
        home = (ImageView) findViewById(R.id.home);
        centerView = (ZoomImageView) findViewById(R.id.centerView);
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.back:
                finish();
                break;
        }
    }
}
